package com.oktest.measure.item.home

import android.content.Context
import android.graphics.drawable.Drawable
import android.view.View
import android.widget.ImageView
import androidx.core.content.ContextCompat
import com.oktest.measure.R
import com.oktest.measure.kt.start
import com.to.aboomy.banner.HolderCreator

/**
 * @Author hhh
 * @Date 2020/9/17
 */


class ImageLoadingCreator :HolderCreator {
    override fun createView(ctx: Context?, index: Int, o: Any?): View {
        val context = ctx!!
        val iv = ImageView(context)
        val drawable = ContextCompat.getDrawable(context, R.drawable.measure_loading_anim)
        iv.scaleType = ImageView.ScaleType.CENTER
        drawable?.start()
        iv.setBackgroundColor(ContextCompat.getColor(context, R.color.viewBackground_night))
        iv.setImageDrawable(drawable)
        return iv
    }
}